﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.Shell;
using VSIXUtilities.Helpers;
using Microsoft.VisualStudio.Shell.Interop;

namespace VSIXUtilities.Loggers
{
	public class ActivityLogLogger
	{
		static IVsActivityLog VsActivityLog;
		static bool WasInitialized;
		static ActivityLogLogger()
		{
			if(!WasInitialized)
			{
				VsActivityLog = ServiceProvider.GlobalProvider.GetService(typeof(SVsOutputWindow)) as IVsActivityLog;
				WasInitialized = true;
			}
		}
		public static void Log(string Message, TaskErrorCategory/*__ACTIVITYLOG_ENTRYTYPE*/ Category)
		{
			DebugHelper.LogCall();
			if(string.IsNullOrEmpty(Message) || VsActivityLog == null)
			{
				return;
			}
			VsActivityLog.LogEntry((UInt32)Category + 1, "Sharp.UnusedReferences", Message);
		}
	}
}
